'''
Data classes for extras
'''

from PyQt4 import QtCore, QtGui
import os
import rgeSystem
from rgeSave import *
import rgeDialogs


#for saving
EXTRA_NAME = 9000
STANDARD_DATA = 10000
EXTRA_DATA = 10001
EXTRA_INDEX = 10002
EXTRA_INT = 10003
EXTRA_FLOAT = 10004
EXTRA_BOOL = 10005
EXTRA_STRING = 10006
EXTRA_SCENE = 10007
EXTRA_MODULE = 10008
EXTRA_TILESET = 10009
EXTRA_SPRITE = 10010
EXTRA_ACTOR = 10011
EXTRA_SCRIPT = 10012
VEC_DIMENSIONS = 10300
VEC_SIZE_ITEM = 10301
VEC_INDEX = 10302
VEC_VALUE = 10303
VEC_DEFAULT_VALUE = 10304
VEC_SIZE_VALUE = 10305
VEC_SIZE_INDEX = 10306
VEC_DEFAULT_SIZE = 10307
VEC_INT = 10200
VEC_FLOAT = 10201
VEC_BOOL = 10202
VEC_STRING = 10203
VEC_SCENE = 10204
VEC_MODULE = 10205
VEC_TILESET = 10206
VEC_SPRITE = 10207
VEC_ACTOR = 10208
VEC_SCRIPT = 10209
VEC_INT_ITEM = 10100
VEC_FLOAT_ITEM = 10101
VEC_BOOL_ITEM = 10102
VEC_STRING_ITEM = 10103
VEC_SCENE_ITEM = 10104
VEC_MODULE_ITEM = 10105
VEC_TILESET_ITEM = 10106
VEC_SPRITE_ITEM = 10107
VEC_ACTOR_ITEM = 10108
VEC_SCRIPT_ITEM = 10109
SPECIAL_MIN = 10400
SPECIAL_MAX = 10401
EXTRA_VALUE = 10402


class DataItem(object):
    def __init__(self, Value = False, Name = "No Name", Index = -1):
        self.init(Value, Name, Index)


    def init(self, Value = False, Name = "No Name", Index = -1): #because I don't know how super works
        self.name = Name #also serves as key
        self.index = Index #also serves as key
        self.value = Value
        self.unchanged = False
        self.editor = QtGui.QSpinBox()
        self.label = QtGui.QLabel()
        self.itemName = "" #only used for complex items

        self.itemType = 0

    def getName(self):
        return self.name

    def getIndex(self):
        return self.index

    def getUnchanged(self):
        return self.unchanged

    def getValue(self):
        return self.value

    def getLabel(self):
        self.updateLabel()
        return self.label

    def getValueWidget(self):
        return QtGui.QLabel(str(self.getValue()))

    def getEditor(self):
        return self.editor

    def getUnchangedLabel(self):
        if not self.unchanged:
            Display = ""
        else:
            Display = "*"
        return QtGui.QLabel(Display)

    def setValue(self, NewValue):
        self.value = NewValue

    def setUnchanged(self, Changed):
        self.unchanged = Changed

    def setName(self, NewName):
        self.name = NewName

    def setIndex(self, NewIndex):
        self.index = NewIndex

    def loadFile(self, File):
        Length = CharToInt(File[0:4])
        currentDataLoc = 4
        for i in range(Length):
            Data = pullData(File, currentDataLoc)
            #a switch statement would be nice here
            if Data[1] == EXTRA_VALUE:
                self.loadValue(Data[0])
            elif Data[1] == SPECIAL_MIN:
                self.setMin(CharToInt(Data[0]))
            elif Data[1] == SPECIAL_MAX:
                self.setMax(CharToInt(Data[0]))
            currentDataLoc = currentDataLoc + 4

    def loadValue(self, Data):
        self.setValue(CharToString(Data))

    def connect(self):
        return
    def disconnect(self):
        return
    def update(self):
        return
    def getFile(self):
        File = rgeFile()
        File.append(QtCore.QString(self.getName()).toAscii(), EXTRA_NAME)
        File.appendInt(self.getIndex(), EXTRA_INDEX)
        DataFile = rgeFile()
        self.appendValue(DataFile)
        self.appendSpecial(DataFile)
        File.appendData(DataFile, self.itemType)
        return File

    def appendValue(self, File): #types that don't use strings overwrite this function
        File.append(self.getValue(), EXTRA_VALUE)

    def appendSpecial(self, File):
        return

    def getItemName(self): #only used for complex items
        return self.itemName

    def updateLabel(self):
        self.label.setText(self.getName())


class DataItemVec(DataItem):
    def __init__(self, Dimensions = 1, Sizes = [], Values = None):
        self.vecInit(Dimensions, Sizes, Values)

    def vecInit(self, Dimensions = 1, Sizes = [], Values = None): #becuase I don't know how super works
        if not Values: #I hate you python
            Values = {}
        else:
            Values = dict(Values)
        super(DataItemVec, self).__init__()
        self.dimensions = Dimensions
        self.sizes = {}
        self.values = Values
        self.setDefaultSizes(Sizes)


    def setDimensions(self, NewValue, ClearValues = True):
        if ClearValues:
            self.clearValues()
        self.dimensions = NewValue

    def getDimensions(self):
        return self.dimensions

    def setDefaultSizes(self, List):
        self.defaultSizes = List[:] #copies it

    def getDefaultSize(self):
        return self.defaultSizes

    def checkCounter(self, Counter, TargetList, Index):
        if Counter[0] >= TargetList[0]:
            return False
        for i in range(len(TargetList)):
            if Counter[i] >= TargetList[i]:
                for i2 in range(len(TargetList) - i + 1):
                    Counter[i2 + i] = 0
                Index = Index - 1
        return True

    def convertKey(self, Key):
        if type(Key) == str:
            return Key
        ReturnedKey = ""
        if type(Key) == list:
            for i in range(len(Key)):
                if i > 0:
                    ReturnedKey = ReturnedKey + "."
                ReturnedKey = ReturnedKey + str(Key[i])
        elif type(Key) == int:
            ReturnedKey = str(Key)
        return ReturnedKey

    def addToKey(self, InputKey, Value):
        Key = self.keyToList(InputKey)
        if type(Value) == str:
            Value = self.keyToList(Value)
        if type(Value) == list:
            for x in Value:
                Key.append(x)
        elif type(Value) == int:
            Key.append(Value)
        return Key

    def keyToList(self, Key):
        if type(Key) is list:
            return Key[:]
        List = []
        if type(Key) is str:
            KeyCopy = Key[:]
            while len(KeyCopy) > 0:
                Index = KeyCopy.find(".")
                if Index == -1:
                    List.append(int(KeyCopy))
                    KeyCopy = ""
                else:
                    TempString = KeyCopy[:Index] #pull value and shave of period
                    List.append(int(TempString))
                    KeyCopy = KeyCopy[Index + 1:]
        elif type(Key) is int:
            List.append(Key)
        return List


    def setSizes(self, InputKey, NewValue):
        Key = self.convertKey(InputKey)
        for i in range(self.getSize(Key)):
            TempKey = self.addToKey(Key, i)
            self.setSize(TempKey, NewValue)

    def setSize(self, InputKey, NewValue):
        Key = self.convertKey(InputKey)
        self.sizes[Key] = NewValue


    def clearSize(self):
        self.sizes = {}

    def getSize(self, InputKey):
        Key = self.convertKey(InputKey)
        KeyList = self.keyToList(Key)
        if len(KeyList) < self.getDimensions():
            if Key in self.sizes:
                return self.sizes[Key]
            if len(KeyList) < len(self.getDefaultSize()):
                TestSize = 0
                for i in range(len(KeyList)):
                    TestList = KeyList[:i]
                    TestKey = self.convertKey(TestList)
                    TestSize = self.getDefaultSize()[i]
                    if TestKey in self.sizes:
                        TestSize = self.sizes[TestKey]
                    if KeyList[i] >= TestSize:
                        return 0
                return self.getDefaultSize()[len(KeyList)]
        return 0

    def checkWithinSize(self, InputKey):
        Key = self.convertKey(InputKey)
        TempList = []
        ListKey = self.keyToList(Key)
        for x in ListKey:
            if x >= self.getSize(TempList):
                return False
            TempList.append(x)
        return True

    def appendVecValue(self, InputKey, NewValue):
        Key = self.convertKey(InputKey)
        Size = self.getSize(Key)
        self.setSize(Key, Size + 1)
        TempKey = self.addToKey(Key, Size) #avoids overwriting the key
        self.setValue(TempKey, NewValue)

    def setValue(self, InputKey, NewValue):
        Key = self.convertKey(InputKey)
        self.values[Key] = NewValue

    def getValue(self, InputKey):
        Key = self.convertKey(InputKey)
        if self.checkWithinSize(Key):
            if Key in self.values:
                return self.values[Key]
        return self.getDefaultValue()

    def getValueList(self, InputKey):
        Key = self.convertKey(InputKey)
        Size = self.getSize(Key)
        List = []
        for i in range(Size):
            List.append(self.getValue(self.addToKey(Key, i)))
        return List

    def pop(self, InputKey): #removes and rearranges
        Key = self.convertKey(InputKey)
        ReturnValue = self.getValue(Key)
        if self.checkWithinSize(Key) and Key != "":
            ListKey = self.keyToList(Key)
            SizeKey = ListKey[:-1]
            Pos = int(ListKey[-1:][0])
            Size = self.getSize(SizeKey)
            for i in range(Size - Pos - 1):
                PlaceKey = self.addToKey(SizeKey, Pos + i)
                PullKey = self.addToKey(SizeKey, Pos + i + 1)
                self.setValue(PlaceKey, self.getValue(PullKey))
            self.setSize(SizeKey, Size - 1)
        return ReturnValue


    def clearValues(self):
        self.values = {}

    def getDefaultValue(self):
        return super(DataItemVec, self).getValue()

    def setDefaultValue(self, NewValue):
        super(DataItemVec, self).setValue(NewValue)

    def appendValue(self, File):
        File.appendInt(self.getDimensions(), VEC_DIMENSIONS)
        self.appendDefaultValue(File)
        File.append(self.convertKey(self.getDefaultSize()), VEC_DEFAULT_SIZE)
        for Key in self.sizes.keys():
            if self.getSize(Key) > 0:
                SizeFile = rgeFile()
                SizeFile.append(Key, VEC_SIZE_INDEX)
                SizeFile.appendInt(self.getSize(Key), VEC_SIZE_VALUE)
                File.appendData(SizeFile, VEC_SIZE_ITEM)
        for Key in self.values.keys():
            if self.getValue(Key) != self.getDefaultValue():
                ValueFile = rgeFile()
                for x in self.keyToList(Key):
                    ValueFile.appendInt(x, VEC_INDEX)
                self.appendValueVecItem(ValueFile, Key)
                File.appendData(ValueFile, VEC_VALUE)

    def getItemName(self, InputKey):
        Key = self.convertKey(InputKey)
        return rgeSave.getName(self.getValue(Key))

    def loadDefaultValue(self, Data): #Default value routines are different for non-string items
        self.setDefaultValue(CharToString(Data))

    def appendDefaultValue(self, File):
        File.appendString(self.getDefaultValue(), VEC_DEFAULT_VALUE)

    def appendValueVecItem(self, File, Counter):
        print "busted!"
        return
    def appendFile(self, File, VecFile):
        return


    def loadFile(self, File):
        TempDimensions = 0

        Length = CharToInt(File[0:4])
        currentDataLoc = 4
        for i in range(Length):
            Data = pullData(File, currentDataLoc)
            #a switch statement would be nice here
            if Data[1] == VEC_DIMENSIONS:
                TempDimensions = CharToInt(Data[0])
            elif Data[1] == VEC_SIZE_ITEM:
                self.loadSize(Data[0])
            elif Data[1] == VEC_VALUE:
                self.loadValues(Data[0])
            elif Data[1] == VEC_DEFAULT_VALUE:
                self.loadDefaultValue(Data[0])
            elif Data[1] == SPECIAL_MIN:
                self.setMin(CharToInt(Data[0]))
            elif Data[1] == SPECIAL_MAX:
                self.setMax(CharToInt(Data[0]))
            elif Data[1] == VEC_DEFAULT_SIZE:
                self.setDefaultSizes(self.keyToList(CharToString(Data[0])))
            currentDataLoc = currentDataLoc + 4

        self.setDimensions(TempDimensions, False)

    def loadSize(self, File):
        Key = ""
        Value = 0
        Length = CharToInt(File[0:4])
        currentDataLoc = 4
        for i in range(Length):
            Data = pullData(File, currentDataLoc)
            #a switch statement would be nice here
            if Data[1] == VEC_SIZE_INDEX:
                Key = CharToString(Data[0])
            elif Data[1] == VEC_SIZE_VALUE:
                Value = CharToInt(Data[0])

            currentDataLoc = currentDataLoc + 4

        if Value is not 0:
            self.setSize(Key, Value)


    def loadValues(self, File):
        Key = []
        Value = None
        Length = CharToInt(File[0:4])
        currentDataLoc = 4
        for i in range(Length):
            Data = pullData(File, currentDataLoc)
            #a switch statement would be nice here
            if Data[1] == VEC_INDEX:
                Key.append(CharToInt(Data[0]))
            elif Data[1] == VEC_INT:
                Value = CharToInt(Data[0])
            elif Data[1] == VEC_FLOAT:
                Value = CharToFloat(Data[0])
            elif Data[1] == VEC_BOOL:
                Value = CharToBool(Data[0])
            elif Data[1] == VEC_STRING:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_SCENE:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_TILESET:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_SPRITE:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_ACTOR:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_MODULE:
                Value = CharToString(Data[0])
            elif Data[1] == VEC_SCRIPT:
                Value = CharToString(Data[0])

            currentDataLoc = currentDataLoc + 4

        if Value is not None and len(Key) > 0:
            self.setValue(Key, Value)


class IntItem(DataItem):
    def __init__(self, Value = 0, Name = "No Name", Index = -1):
        super(IntItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.itemType = EXTRA_INT

        self.connect()

        #unique stuff
        self.min = -20000000
        self.max = 20000000

    def connect(self):
        self.editor.clicked.connect(self.update)

    def disconnect(self):
        self.editor.clicked.disconnect(self.update)

    def update(self):
        Dialog = rgeDialog.setValueDialog(rgeViews.mainWindow, "Int", self.getValue(), self.min, self.max)
        if(Dialog.exec_()):
            self.disconnect()
            self.setValue(Dialog.returnedValue)
            self.connect()
            self.updateLabel()


    def loadValue(self, Data):
        self.setValue(CharToInt(Data))

    def appendValue(self, File):
        File.appendInt(self.getValue(), EXTRA_VALUE)

    def appendSpecial(self, File):
        File.appendInt(self.getMin(), SPECIAL_MIN)
        File.appendInt(self.getMax(), SPECIAL_MAX)

    def updateLabel(self):
        self.label.setText(self.getName() + ": " + self.getValue())

    #unique functions

    def setMin(self, NewMin):
        self.min = NewMin

    def setMax(self, NewMax):
        self.max = NewMax

    def getMin(self):
        return self.min

    def getMax(self):
        return self.max


class IntVecItem(DataItemVec):
    def __init__(self, DefaultValue = 0, Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_INT_ITEM

        #unique stuff
        self.min = -20000000
        self.max = 20000000

    def update(self):
        #make a dialog for this
        return


    def appendSpecial(self, File):
        File.appendInt(self.getMin(), SPECIAL_MIN)
        File.appendInt(self.getMax(), SPECIAL_MAX)

    def loadDefaultValue(self, Data):
        self.setDefaultValue(CharToInt(Data))

    def appendDefaultValue(self, File):
        File.appendInt(self.getDefaultValue(), VEC_DEFAULT_VALUE)

    def appendValueVecItem(self, File, Counter):
        File.appendInt(self.getValue(Counter), VEC_INT)


    #unique stuff
    def setMin(self, NewMin):
        self.min = NewMin

    def setMax(self, NewMax):
        self.max = NewMax

    def getMin(self):
        return self.min

    def getMax(self):
        return self.max


class FloatItem(IntItem):
    def __init__(self, Value = 0, Name = "No Name", Index = -1):
        super(FloatItem, self).__init__(Value, Name, Index)
        self.itemType = EXTRA_FLOAT

    def update(self):
        Dialog = rgeDialog.setValueDialogFloat(rgeViews.mainWindow, "Int", self.getValue(), self.min, self.max)
        if(Dialog.exec_()):
            self.disconnect()
            self.setValue(Dialog.returnedValue)
            self.connect()
            self.updateLabel()


    def loadValue(self, Data):
        self.setValue(CharToFloat(Data))

    def appendValue(self, File):
        File.appendFloat(self.getValue(), EXTRA_VALUE)


class FloatVecItem(IntVecItem):
    def __init__(self, DefaultValue = 0, Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        super(FloatVecItem, self).__init__(DefaultValue, Name, Index, Dimensions, Sizes, Values)
        self.itemType = VEC_FLOAT_ITEM


    def update(self):
        #make a dialog for this too
        return

    def loadDefaultValue(self, Data):
        self.setDefaultValue(CharToFloat(Data))

    def appendDefaultValue(self, File):
        File.appendFloat(self.getDefaultValue(), VEC_DEFAULT_VALUE)

    def appendValueVecItem(self, File, Counter):
        File.appendFloat(self.getValue(Counter), VEC_FLOAT)

    def appendFile(self, File, VecFile):
        File.appendData(VecFile, VEC_FLOAT_ITEM)



class BoolItem(DataItem):
    def __init__(self, Value = False, Name = "No Name", Index = -1):
        super(BoolItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QCheckBox()
        self.itemType = EXTRA_BOOL
        self.updateBox()
        self.connect()

    def setValue(self, NewValue):
        self.value = NewValue
        self.updateBox()

    def getLabel(self):
        self.updateLabel()
        return self.getLabel()

    def connect(self):
        self.editor.toggled.connect(self.update)

    def update(self):
        self.setValue(self.editor.checked())
        self.updateBox()


    def loadValue(self, Data):
        self.setValue(CharToBool(Data))

    def appendValue(self, File):
        File.appendBool(self.getValue(), EXTRA_VALUE)


    #unique stuff

    def updateBox(self):
        self.editor.setChecked(self.value)

class BoolVecItem(DataItemVec):
    def __init__(self, DefaultValue = False, Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_BOOL_ITEM


    def update(self):
        #make a dialog for this
        return

    def loadDefaultValue(self, Data):
        self.setDefaultValue(CharToBool(Data))

    def appendDefaultValue(self, File):
        File.appendBool(self.getDefaultValue(), VEC_DEFAULT_VALUE)

    def appendValueVecItem(self, File, Counter):
        File.appendBool(self.getValue(Counter), VEC_BOOL)



class StringItem(DataItem):
    def __init__(self, Value = "Empty", Name = "No Name", Index = -1):
        super(StringItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QLineEdit(self.getValue())
        self.itemType = EXTRA_STRING
        self.connect()


    def connect(self):
        self.editor.returnPressed.connect(self.update)

    def update(self):
        self.setValue(self.editor.text())



class StringVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_STRING_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_STRING)



class SceneItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(SceneItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.editor.clicked.connect(self.update)
        self.itemType = EXTRA_SCENE


    def update(self):
        SceneDialog = rgeViews.chooseScene()
        if SceneDialog:
            self.setValue(SceneDialog.selectedFile)
            self.itemName = rgeSave.getName(SceneDialog.selectedFile)

    def getValueWidget(self):
        return QtGui.QLabel(self.getItemName())

    def appendValue(self, File):
        File.append(self.getValue(), EXTRA_VALUE)


class SceneVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_SCENE_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_SCENE)



class ModuleItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(ModuleItem, self).__init__(Value, Name, Index)
        self.itemType = EXTRA_MODULE
        #nothing really here yet

class ModuleVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_MODULE_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_MODULE)


class TilesetItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(TilesetItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.editor.clicked.connect(self.update)
        self.itemType = EXTRA_TILESET

    def update(self):
        Dialog = rgeViews.chooseTileset()
        if Dialog:
            self.setValue(Dialog.selectedFile)
            self.itemName = rgeSave.getName(Dialog.selectedFile)

    def getValueWidget(self):
        return QtGui.QLabel(self.getItemName())


class TilesetVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_TILESET_ITEM


    def update(self):
        #make a dialog for this
        return


    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_TILESET)


class SpriteItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(SpriteItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.editor.clicked.connect(self.update)
        self.itemType = EXTRA_SPRITE

    def update(self):
        Dialog = rgeViews.chooseSprite()
        if Dialog:
            self.setValue(Dialog.selectedFile)
            self.itemName = rgeSave.getName(Dialog.selectedFile)

    def getValueWidget(self):
        return QtGui.QLabel(self.getItemName())




class SpriteVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_SPRITE_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_SPRITE)



class ActorItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(ActorItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.editor.clicked.connect(self.update)
        self.itemType = EXTRA_ACTOR

    def update(self):
        Dialog = rgeViews.chooseActor()
        if Dialog:
            self.setValue(Dialog.selectedFile)
            self.itemName = rgeSave.getName(Dialog.selectedFile)

    def getValueWidget(self):
        return QtGui.QLabel(self.getItemName())



class ActorVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_ACTOR_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_ACTOR)


class ScriptItem(DataItem):
    def __init__(self, Value = "", Name = "No Name", Index = -1):
        super(ScriptItem, self).__init__(Value, Name, Index)
        self.editor = QtGui.QPushButton("Change")
        self.editor.clicked.connect(self.update)
        self.itemType = EXTRA_SCRIPT

    def update(self):
        Dialog = rgeViews.chooseScript()
        if Dialog:
            self.setValue(Dialog.selectedFile)
            self.itemName = rgeSave.getName(Dialog.selectedFile)

    def getValueWidget(self):
        return QtGui.QLabel(self.getItemName())


class ScriptVecItem(DataItemVec):
    def __init__(self, DefaultValue = "", Name = "No Name", Index = -1, Dimensions = 1, Sizes = [], Values = {}):
        self.vecInit(Dimensions, Sizes, Values)
        self.init(DefaultValue, Name, Index)
        self.editor = QtGui.QPushButton("Set Values")
        self.editor.clicked.connect(self.update)
        self.itemType = VEC_SCRIPT_ITEM


    def update(self):
        #make a dialog for this
        return

    def appendValueVecItem(self, File, Counter):
        File.appendString(self.getValue(Counter), VEC_SCRIPT)
